<?phpjavascript:;

namespace Home\Controller;

use Think\Controller;

class IndexController extends Controller {

    public function index() {
        
     
        exit;
        echo time();
    }
    
    public function updateSchTime(){
           $t = strtotime('2022-01-01');

        $lists = M("source")->field("id,time_create,addtime")->where("time_create <= " . $t . "")->select();
      
        foreach ($lists as $v) {
    $timeAdd = $v['time_create'] ? $v['time_create'] : $v['addtime'];
            $tNew = date("2022-" . date("m-d H:i:s", $timeAdd));
         
            $tNewTime = strtotime($tNew);
         M("source")->where("id = " . $v['id'] . "")->save(array('time_create' => $tNewTime));
        }
    }

}
